# compiler flags
SDL_LIB = -lSDL2 -lSDL2_image
CXXFLAGS = -Wall -c
LDFLAGS = $(SDL_LIB)

# files
SRC = $(wildcard *.c ${TARGET}/*.c ${GAME})
OBJ = ${SRC:.c=.o}
HEADERS = $(wildcard *.h ${TARGET}/*.h)

# if GAME is defined, compile to the final game
all: ${OBJ}
	test ! ${GAME} || ${CC} ${OBJ} -o output ${LDFLAGS}

# how to compile C files
.c.o:
	$(CC) -c -o ${<:.c=.o} $< -I .

# for now, all objects depend on all headers
${OBJ}: ${HEADERS}

# clean files
clean:
	rm ${OBJ}
